<?php !defined('DYHB_PATH') && exit; /* DoYouHaoBaby Framework 模板缓存文件 生成时间：2011-05-28 11:31:18  */ ?>
<?php $this->includeChildTemplate( "".APP_PATH."/Tpl/Default/public_header.html" ,"" ,"" ,"" )  ;?>

<script type="text/javascript">
$(document).ready(function() {
    $("#node_access").change(function() {
        if (this.value != 0){
            $("#ajaxSelect").css('display','block');
		    $("#ajaxSelect").load("<?php echo( G::U('node/get_access') );?>", {
                access: this.value
            });
        }
        else{

            $("#ajaxSelect").css('display','none');
        }
	});
});
</script>

<script type="text/javascript">
<!--
function add(){
	Dyhb.AjaxSubmit('nodeAdd','<?php echo( G::U('node/insert') );?>','',complete);
}
function update(){
	Dyhb.AjaxSubmit('nodeAdd','<?php echo( G::U('node/update') );?>');
}
function complete(data,status){
    if(status==1){

        $('#id').val(data.id);
    }
}

-->
</script>

   <!-- 标题  -->
   <div class="title"><?php if(empty( $nId )) :?><?php print G::L( "添加节点", null, null ) ; ?><?php else: ?><?php print G::L( "编辑节点", null, null ) ; ?><?php endif; ?> ( <a href="<?php echo( G::U('node/index') );?>"><?php print G::L( "返回节点列表", null, null ) ; ?></a> )</div>

  <!-- 正文 -->
  <div id="content" class="content">
      <form action="<?php if(empty( $nId )) :?><?php echo( G::U('node/insert') );?><?php else: ?><?php echo( G::U('node/update') );?><?php endif; ?>" method="post" id="nodeAdd">
      <table class="form-table full">
          <tr>
            <th valign="top"><label for="node_access"><?php print G::L( "授权", null, null ) ; ?>：</label></th>
            <td><SELECT class="field"  name="node_access" id="node_access">
                 <option value="0" <?php if(isset( $arrValue ) && $arrValue['node_level']==1) :?>selected<?php endif; ?>>-- <?php print G::L( "请选择", null, null ) ; ?> --</option>
	             <option value="app" <?php if(isset( $arrValue ) && $arrValue['node_level']==2) :?>selected<?php endif; ?>><?php print G::L( "应用", null, null ) ; ?></option>
	             <option value="module" <?php if(isset( $arrValue ) && $arrValue['node_level']==3) :?>selected<?php endif; ?>><?php print G::L( "模块", null, null ) ; ?></option>
	             </SELECT>
	             <div class="description"><?php print G::L( "请选择授权应用和模块", null, null ) ; ?></div>
            </td>
          </tr>
          <tr class="none" id="ajaxSelect"><td><img
			src="__TMPLPUB__/Images/ajaxloading.gif"></img><?php print G::L( "数据加载中...", null, null ) ; ?>
            <?php if(empty( $nId )) :?><input type="hidden" name="node_level" value="1"><?php endif; ?>
            <input type="hidden" name="node_parentid" value="<?php if(isset( $arrValue ) && $arrValue['node_parentid']) :?><?php echo( $arrValue['node_parentid'] ); ?><?php else: ?>0<?php endif; ?>"></td>
          </tr>
          <tr>
            <th valign="top"><label for="node_sort"><?php print G::L( "序号", null, null ) ; ?>：</label></th>
            <td><input type="text" name="node_sort" id="node_sort" class="field" size="40"  value="<?php if(isset( $arrValue ) && $arrValue['node_sort']) :?><?php echo( $arrValue['node_sort'] ); ?><?php else: ?>0<?php endif; ?>"/>
            <div class="description"><?php print G::L( "节点序号，用于排列节点顺序", null, null ) ; ?></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="node_name"><?php print G::L( "应用名", null, null ) ; ?>：</label></th>
            <td><input type="text" name="node_name" id="node_name" class="field" size="40" value="<?php if(isset( $arrValue )) :?><?php echo( $arrValue['node_name'] ); ?><?php endif; ?>"/>
            <div class="description"><?php print G::L( "节点的名字", null, null ) ; ?></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="node_title"><?php print G::L( "显示名", null, null ) ; ?>：</label></th>
            <td><input type="text" name="node_title" id="node_title" class="field" size="40" value="<?php if(isset( $arrValue )) :?><?php echo( $arrValue['node_title'] ); ?><?php endif; ?>"/>
            <div class="description"><?php print G::L( "节点的别名", null, null ) ; ?></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="group_id"><?php print G::L( "分组", null, null ) ; ?>：</label></th>
            <td><SELECT class="field"  name="group_id" id="group_id">
                 <?php $i=1 ;?>
<?php if( is_array( $arrGroup ) ) : foreach( $arrGroup as $key=>$value): ?>

	             <option value="<?php echo( $value['group_id'] ); ?>" <?php if( isset( $arrValue ) && $value['group_id']==$arrValue['group_id'] ) :?>selected<?php endif; ?>><?php echo( $value['group_title'] ); ?></option>
	             
<?php $i++ ;?>
<?php endforeach;endif; ?>
	           </SELECT>
	           <div class="description"><?php print G::L( "节点的分组", null, null ) ; ?></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="node_status"><?php print G::L( "状态", null, null ) ; ?>：</label></th>
            <td><SELECT class="field"  name="node_status">
	             <option value="1" <?php if(isset( $arrValue ) && $arrValue['node_status']==1) :?>selected<?php endif; ?>><?php print G::L( "启用", null, null ) ; ?></option>
	             <option value="0" <?php if(!isset( $arrValue ) || ( isset( $arrValue ) && $arrValue['node_status'] == 0 ) ) :?>selected<?php endif; ?>><?php print G::L( "禁用", null, null ) ; ?></option>
	           </SELECT>
	           <div class="description"><?php print G::L( "是否启用节点，启用节点才能够使用", null, null ) ; ?></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="node_remark"><?php print G::L( "备注", null, null ) ; ?>：</label></th>
            <td><textarea name="node_remark" id="node_remark" class="field" cols="70" rows="5"><?php if(isset( $arrValue )) :?><?php echo( $arrValue['node_remark'] ); ?><?php endif; ?></textarea>
            <div class="description"><?php print G::L( "节点其它相关信息", null, null ) ; ?></div></td>
          </tr>

          </table>
          <p class="center"><input type="hidden" name="ajax" value="1">
          <input type="hidden" name="id" id="id" value="<?php if(isset( $nId )) :?><?php echo( $nId ); ?><?php endif; ?>"/>
          <input type="button" onclick="<?php if(!empty( $nId )) :?>update()<?php else: ?>add()<?php endif; ?>"  class="button" value="<?php if(!empty( $nId )) :?>  <?php print G::L( "更  新", null, null ) ; ?><?php else: ?>  <?php print G::L( "发  布", null, null ) ; ?><?php endif; ?>  " />
          <input type="reset" class="button" value="  <?php print G::L( "重  置", null, null ) ; ?>  " />
        </p>
        </form>
   </div>
   <!-- end content -->

<?php $this->includeChildTemplate( "".APP_PATH."/Tpl/Default/public_footer.html" ,"" ,"" ,"" )  ;?>